import request from "@/utils/request";

const LOG_BASE_URL = "/v3/data/download";

class downloadApi {
  // 批量指令
  static batchDownloadProperty(data: batchDownload) {
    return request({
      url: `${LOG_BASE_URL}/batchDownloadProperty`,
      method: "post",
      params: data,
    });
  }
  // 设置BT
  static setBTCode(data: batchBTCode[]) {
    return request({
      url: `${LOG_BASE_URL}/setBTCode`,
      method: "post",
      params: data,
    });
  }

  static downloadProperty(data: downloadsubmit) {
    return request({
      url: `${LOG_BASE_URL}/downloadProperty`,
      method: "post",
      data: data,
    });
  }
  static downloadPointUpload(data: downloadUpload) {
    return request({
      url: `${LOG_BASE_URL}/downloadPointUpload`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: data,
    });
  }
}

export default downloadApi;

export interface point {
  pointCode: string;
  value: string;
}
export interface downloadsubmit {
  deviceId: number;
  property: point[];
}

export interface batchDownload {
  deviceTypeId: string;
  deviceIdList: string[];
  property: point[];
}
export interface batchBTCode {
  deviceId: string;
  btCode: string;
}
export interface downloadUpload {
  deviceId: string;
  pointGroupTypeFlag: string;
}
